<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>JSDoc: Source: index.js</title>

    <script src="scripts/prettify/prettify.js"> </script>
    <script src="scripts/prettify/lang-css.js"> </script>
    <!--[if lt IE 9]>
      <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
    <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
    <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>

<body>

<div id="main">

    <h1 class="page-title">Source: index.js</h1>

    



    
    <section>
        <article>
            <pre class="prettyprint source linenums"><code>/*!
 * qcloudsms_js
 */

"use strict";

/**
 * Module dependencies.
 * @ignore
 */

var sms = require("./sms");
var voice = require("./voice");


/**
 * Expose `createQcloudSms`.
 */

exports = module.exports = createQcloudSms;


/**
 * Create a QcloudSms instance
 *
 * @param  {string}  appid  - sdk appid
 * @param  {string}  appkey - sdk appkey
 * @return {object}
 */
function createQcloudSms(appid, appkey) {
    if (!appid || !appkey) {
        throw new Error("Require appid and appkey!");
    }
    var qcloudsms = {appid: appid, appkey: appkey};

    var ssender, msender;
    qcloudsms.SmsSingleSender = function() {
        if (!ssender) {
            ssender = new sms.SmsSingleSender(qcloudsms.appid, qcloudsms.appkey);
        }
        return ssender;
    };
    qcloudsms.SmsMultiSender = function() {
        if (!msender) {
            msender = new sms.SmsMultiSender(qcloudsms.appid, qcloudsms.appkey);
        }
        return msender;
    };

    var spuller, mspuller;
    qcloudsms.SmsStatusPuller = function() {
        if (!spuller) {
            spuller = new sms.SmsStatusPuller(qcloudsms.appid, qcloudsms.appkey);
        }
        return spuller;
    };
    qcloudsms.SmsMobileStatusPuller = function() {
        if (!mspuller) {
            mspuller = new sms.SmsMobileStatusPuller(qcloudsms.appid, qcloudsms.appkey);
        }
        return mspuller;
    };

    var pvsender, cvsender;
    qcloudsms.SmsVoicePromptSender = function() {
        if (!pvsender) {
            pvsender = new voice.SmsVoicePromptSender(qcloudsms.appid, qcloudsms.appkey);
        }
        return pvsender;
    };
    qcloudsms.PromptVoiceSender = function() {
        if (!pvsender) {
            pvsender = new voice.PromptVoiceSender(qcloudsms.appid, qcloudsms.appkey);
        }
        return pvsender;
    };
    qcloudsms.SmsVoiceVerifyCodeSender = function() {
        if (!cvsender) {
            cvsender = new voice.SmsVoiceVerifyCodeSender(qcloudsms.appid, qcloudsms.appkey);
        }
        return cvsender;
    };
    qcloudsms.CodeVoiceSender = function() {
        if (!cvsender) {
            cvsender = new voice.CodeVoiceSender(qcloudsms.appid, qcloudsms.appkey);
        }
        return cvsender;
    };

    var tvsender;
    qcloudsms.TtsVoiceSender = function() {
        if (!tvsender) {
            tvsender = new voice.TtsVoiceSender(qcloudsms.appid, qcloudsms.appkey);
        }
        return tvsender;
    };

    var uploader, fvsender;
    qcloudsms.VoiceFileUploader = function() {
        if (!uploader) {
            uploader = new voice.VoiceFileUploader(qcloudsms.appid, qcloudsms.appkey);
        }
        return uploader;
    };
    qcloudsms.FileVoiceSender = function() {
        if (!fvsender) {
           fvsender = new voice.FileVoiceSender(qcloudsms.appid, qcloudsms.appkey);
        }
        return fvsender;
    };

    return qcloudsms;
}
</code></pre>
        </article>
    </section>




</div>

<nav>
    <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="CodeVoiceSender.html">CodeVoiceSender</a></li><li><a href="FileVoiceSender.html">FileVoiceSender</a></li><li><a href="PromptVoiceSender.html">PromptVoiceSender</a></li><li><a href="SmsMobileStatusPuller.html">SmsMobileStatusPuller</a></li><li><a href="SmsMultiSender.html">SmsMultiSender</a></li><li><a href="SmsSingleSender.html">SmsSingleSender</a></li><li><a href="SmsStatusPuller.html">SmsStatusPuller</a></li><li><a href="TtsVoiceSender.html">TtsVoiceSender</a></li><li><a href="VoiceFileUploader.html">VoiceFileUploader</a></li></ul><h3>Global</h3><ul><li><a href="global.html"></a></li><li><a href="global.html#assert">assert</a></li><li><a href="global.html#calculateAuth">calculateAuth</a></li><li><a href="global.html#calculateSignature">calculateSignature</a></li><li><a href="global.html#createQcloudSms">createQcloudSms</a></li><li><a href="global.html#getCurrentTime">getCurrentTime</a></li><li><a href="global.html#getRandom">getRandom</a></li><li><a href="global.html#request">request</a></li><li><a href="global.html#sha1sum">sha1sum</a></li></ul>
</nav>

<br class="clear">

<footer>
    Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Wed Jan 30 2019 15:26:32 GMT+0800 (CST)
</footer>

<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>
